<template>
    <div class="achievements-wrap" v-wechat="$route.meta.title">
        <div class="achievements-step">
            <Step :active="1"/>
        </div>
        <div class="achievements-body">
            <van-form @submit="onSubmit" input-align="right" class="achievements-form">
                <div class="achievements-box">

                    <h2 class="achievements-title">
                        {{$t('message.cglx')}}：{{form.releaseCode}}
                    </h2>

                    <h2>{{$t('addMsg.deb')}}：{{$t('addMsg.txjbxx')}}</h2>

                    <div class="title-box">
                        <h6>{{$t('message.cgmc')}}</h6>
                    </div>

                    <!-- 中文名称 -->
                    <van-field
                        required
                        v-model="form.releaseTitleCn"
                        name="releaseTitleCn"
                        :label="$t('message.name')"
                        :placeholder="$t('message.p-cgmc')"
                        :rules="[
                { required: true, message: $t('message.p-cgmc')},
                { validator: asyncReleaseTitleCnValidator, message: $t('lackMsg.p-qsz') },
                { validator: asyncReleaseTitleCnengValidator, message: $t('message.m3') },
                ]"
                    />
                    <!-- 英文名称 -->
                    <van-field
						v-if="isShowEnglish"
                        v-model="form.releaseTitleEn"
                        name="releaseTitleEn"
                        :label="$t('message.english')"
                        :placeholder="$t('message.p-en')"
                        :rules="[{ validator: asyncValidator, message: $t('lackMsg.bnsrzw') }, ]"
                    />
                    <!-- $t('message.p-en') -->
                </div>

                <div class="achievements-box">
                    <div class="title-box">
                        <h6>{{$t('message.cgjj')}}</h6>
                    </div>

                    <!-- 发布日期 -->
                    <van-field
                        clickable
                        required
                        readonly
                        :name="$t('message.fbrq')"
                        :value="form.releaseTime"
                        :label="$t('message.fbrq')"
                        :placeholder="$t('addMsg.p-fbrq')"
                        @click="releaseTimeShow"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('addMsg.p-fbrq'), trigger: 'onChange' }]"
                    />

                    <!-- 发布地区 -->
                    <van-field
                        clickable
                        required
                        readonly
                        :name="$t('message.fbdq')"
                        :value="form.border"
                        :label="$t('message.fbdq')"
                        :placeholder="$t('message.xzjnw')"
                        @click="regionShowPicker = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('message.xzjnw'), trigger: 'onChange' }]"
                    />

                    <!-- 境内(省) -->
                    <van-field
                        required
                        readonly
                        v-if="achievementsForm.border==='within'"
                        clickable
                        :name="$t('message.qbsf')"
                        :value="form.province"
                        :label="$t('message.qbsf')"
                        :placeholder="$t('message.qbsf')"
                        @click="provinceShowPicker = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('lackMsg.p-xzsf'), trigger: 'onChange' }]"
                    />

                    <!-- 境内(市) -->
                    <van-field
                        required
                        readonly
                        v-if="achievementsForm.border==='within' && cityCodeType.length"
                        clickable
                        :name="$t('message.gndq')"
                        :value="form.cityCode"
                        label=" "
                        :placeholder="$t('message.p-qxz')"
                        @click="cityCodeShowPicker = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('lackMsg.p-xzsq'), trigger: 'onChange' }]"
                    />

                    <!-- 境外 -->
                    <van-field
                        required
                        readonly
                        v-if="achievementsForm.border==='overseas'"
                        clickable
                        :name="$t('message.gbdq')"
                        :value="form.regionCode"
                        :label="$t('message.gbdq')"
                        :placeholder="$t('message.xzdq')"
                        @click="overseasShowPicker = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('message.xzdq'), trigger: 'onChange' }]"
                    />

                    <!-- 中方企业属地(省) -->
                    <van-field
                        required
                        readonly
                        v-if="achievementsForm.border==='overseas'"
                        clickable
                        :name="$t('message.qbsf')"
                        :value="form.attributionProvince"
                        :label="$t('lackMsg.zfqysd')"
                        :placeholder="$t('message.qbsf')"
                        @click="provinceShowPicker2 = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('lackMsg.p-xzsf'), trigger: 'onChange' }]"
                    />

                    <!-- 中方企业属地(市) -->
                    <van-field
                        required
                        readonly
                        v-if="achievementsForm.border==='overseas' && cityCodeType2.length"
                        clickable
                        :name="$t('message.gndq')"
                        :value="form.attributionCityCode"
                        label=" "
                        :placeholder="$t('message.p-qxz')"
                        @click="cityCodeShowPicker2 = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('lackMsg.p-xzsq'), trigger: 'onChange' }]"
                    />

                    <!-- 发布层级 -->
                    <van-field
                        required
                        readonly
                        clickable
                        :name="$t('message.fbcj')"
                        :value="form.releaseLevel"
                        :label="$t('message.fbcj')"
                        :placeholder="$t('message.p-fbcj')"
                        @click="releaseLevelShowPicker = true"
                        right-icon="arrow"
                        :rules="[{ required: true, message: $t('message.p-fbcj'), trigger: 'onChange' }]"
                    />

                    <!-- 发布内容 -->
                    <van-field class="achievements-textarea" :label="$t('message.fbnr')" required>
                        <template #input>
                            <van-field
                                v-model="form.releaseContent"
                                :autosize="true"
                                input-align="left"
                                type="textarea"
                                :name="$t('message.fbnr')"
                                rows="3"
                                :placeholder="$t('message.p-srnr')"
                                show-word-limit
                                maxlength="512"
                                :rules="[{ required: true, message: $t('message.p-srnr')  }]"
                            />
                        </template>
                    </van-field>

                    <!-- 上传文件 -->
                    <van-field name="uploader" input-align="left" class="achievements-upload">
                        <template #input>
                            <upLoadFile ref="uploadFile" :pfileList="form.ossUrlList"/>
                        </template>
                    </van-field>
                </div>

                <div class="achievements-submit">
                    <van-button
                        round
                        size="large"
                        color="linear-gradient(90deg, #FECF47 0%, #FFBC39 100%)"
                        native-type="button"
                        :loading="storeLoading"
                        @click="savingAchievementsData"
                    >{{$t('message.zc')}}
                    </van-button>

                    <van-row class="status-btn">
                        <van-col span="11">
                            <van-button
                                round
                                size="large"
                                native-type="button"
                                @click="returnFn"
                            >{{$t('addMsg.syb')}}
                            </van-button>
                        </van-col>
                        <van-col span="2"></van-col>
                        <van-col span="11">
                            <van-button round size="large" native-type="submit">{{$t('addMsg.xyb')}}</van-button>
                        </van-col>
                    </van-row>
                </div>
            </van-form>

            <!-- 发布日期mask -->
            <van-popup v-model="releaseTimeShowPicker" position="bottom">
                <van-datetime-picker
                    v-model="currentDate"
                    :min-date="minDate"
                    :max-date="maxDate"
                    :title="$t('message.fbrq')"
                    type="date"
                    @confirm="releaseTimeConfirm"
                    @cancel="releaseTimeShowPicker = false"
                />
            </van-popup>

            <!-- 发布地区mask -->
            <van-popup v-model="regionShowPicker" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="regionType"
                    @confirm="regionConfirm"
                    @cancel="regionShowPicker = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>

            <!-- 境内省mask -->
            <van-popup v-model="provinceShowPicker" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="provinceType"
                    @confirm="provinceConfirm"
                    @cancel="provinceShowPicker = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>

            <!-- 境内市mask -->
            <van-popup v-model="cityCodeShowPicker" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="cityCodeType"
                    @confirm="cityCodeConfirm"
                    @cancel="cityCodeShowPicker = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>

            <!-- 境外mask -->
            <van-popup v-model="overseasShowPicker" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="overseasType"
                    @confirm="overseasConfirm"
                    @cancel="overseasShowPicker = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>
            <!-- 中方企业属地 -->
            <van-popup v-model="provinceShowPicker2" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="provinceType2"
                    @confirm="provinceConfirm2"
                    @cancel="provinceShowPicker2 = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>
            <van-popup v-model="cityCodeShowPicker2" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="cityCodeType2"
                    @confirm="cityCodeConfirm2"
                    @cancel="cityCodeShowPicker2 = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>

            <!-- 发布层级mask -->
            <van-popup v-model="releaseLevelShowPicker" position="bottom">
                <van-picker
                    show-toolbar
                    :columns="releaseLevelList"
                    @confirm="releaseLevelConfirm"
                    @cancel="releaseLevelShowPicker = false"
                    :confirm-button-text="$t('message.ture')"
                    :cancel-button-text="$t('message.false')"
                />
            </van-popup>
        </div>
    </div>
</template>

<script>
    import Step from '@/components/StepBar'
    import upLoadFile from '../../components/uploadFile'
    import Cookie from 'js-cookie'
    import buried from '@/utils/buried'

    export default {
        components: {
            Step,
            upLoadFile
        },
        data () {
            return {
                form: {
                    // 移动端显示
                    releaseContent: '', // 发布内容
                    border: '', // 发布地区
                    releaseTime: '', // 发布日期
                    releaseTitleCn: '', // 成果中文名称
                    releaseTitleEn: '', // 成果英文名称
                    releaseLevel: '', // 发布层级
                    regionCode: '', // 国家编码
                    cityCode: '', // 市及编码
                    province: '', // 省级编码
                    ossUrlList: [], // 附件
                    releaseFieldOne: '', // 发布领域一级
                    releaseFieldTwo: '', // 发布领域二级
                    releaseFieldThree: '', // 发布领域三级
                    attributionCityCode: '',
                    attributionProvince: ''
                },
                achievementsForm: {
                    border: '', // 发布地区
                    releaseTitleCn: '', // 成果中文名称
                    releaseTitleEn: '', // 成果英文名称
                    releaseTime: '', // 发布日期
                    releaseLevel: '', // 发布层级
                    releaseContent: '', // 发布内容
                    regionCode: '', // 国家编码
                    cityCode: '', // 市及编码
                    province: '', // 省级编码
                    ossUrlList: [], // 附件
                    releaseFieldOne: '', // 发布领域一级
                    releaseFieldTwo: '', // 发布领域二级
                    releaseFieldThree: '', // 发布领域三级
                    attributionCityCode: '',
                    attributionProvince: ''
                },
                regionShowPicker: false, // 控制发布地区mask显示隐藏
                releaseTimeShowPicker: false, // 控制发布日期mask显示隐藏
                releaseLevelShowPicker: false, // 控制发布层级mask显示隐藏
                provinceShowPicker: false, // 控制境内省mask显示隐藏
                cityCodeShowPicker: false, // 控制境内市mask显示隐藏
                provinceShowPicker2: false,
                cityCodeShowPicker2: false,
                overseasShowPicker: false, // 控制境外mask显示隐藏
                value: '',
				isShowEnglish:true,
                showPicker: false,
                provinceType: [], // 境内省数据
                provinceType2: [],
                overseasType: [], // 境外数据
                maxLen: 10, // 上传图片最大长度
                storeId: 0, // 暂存 Id
                currentDate: new Date(), // 初始日期
                minDate: new Date(1960, 0, 1), // 开始时间 - 结束时间
                maxDate: new Date(2060, 10, 1), // 开始时间 - 结束时间
                storeLoading: false // 暂存
            }
        },
        watch: {
            'form.releaseTitleCn' (newVal) {
                this.achievementsForm.releaseTitleCn = newVal
            },
            'form.releaseTitleEn' (newVal) {
                this.achievementsForm.releaseTitleEn = newVal
            },
            'form.releaseContent' (newVal) {
                this.achievementsForm.releaseContent = newVal
            },
            'form.ossUrlList' (newArr) {
                this.achievementsForm.ossUrlList = newArr
            }
        },
        computed: {
            regionType () {
                // 发布地区列表
                const regionType = this.$store.state.regionType // 获取发布地区列表
                return regionType.map(item => ({
                    text: item.label,
                    value: item.value
                }))
            },
            releaseLevelList () {
                // 发布层级数据
                const releaseLevelList = this.$store.state.releaseLevelList // 获取发布地区列表
                return releaseLevelList.map(item => ({
                    text: item.label,
                    value: item.value
                }))
            },
            siteLang () {
                // 设置默认 cookie
                return Cookie.get('site_lang') || 'zh-CN'
            },
            query () {
                // 路由参数
                return this.$route.query
            },
            type () {
                // 路由参数type
                return this.query.type
            },
            id () {
                // 路由参数id
                return this.query.id
            },
            cityCodeType () {
                // 境内市数据
                const ind = this.provinceType.findIndex(
                    item => item.value === this.achievementsForm.province
                )
                if (ind === -1) return []
                const { subordinateProvinceList } = this.provinceType[ind]
                return subordinateProvinceList.map(item => ({
                    text: this.siteLang === 'zh-CN' ? item.province : item.nameEn,
                    value: item.code
                }))
            },
            cityCodeType2 () {
                // 境内市数据
                const ind = this.provinceType2.findIndex(
                    item => item.value === this.achievementsForm.attributionProvince
                )
                if (ind === -1) return []
                const { subordinateProvinceList } = this.provinceType2[ind]
                return subordinateProvinceList.map(item => ({
                    text: this.siteLang === 'zh-CN' ? item.province : item.nameEn,
                    value: item.code
                }))
            },
            addTypeList () {
                return this.$store.state.addTypeList;
            },
        },
        async created () {
            // this.form.releaseCode = this.type;
            const res = await this.$axios.post(
                '/api/dictionary/listDictionarysGroupBy'
            )
            const { data } = res
            if (data.code === 200) {
                this.overseasType = await data.data.regions.map(item => ({
                    text: this.siteLang === 'zh-CN' ? item.name : item.nameEn,
                    value: item.code
                }))
                this.provinceType2 = this.provinceType = await data.data.province.map(item => ({
                    text: this.siteLang === 'zh-CN' ? item.province : item.nameEn,
                    value: item.code,
                    subordinateProvinceList: item.subordinateProvinceList
                }))
            }
            if (this.id) {
                await this.getDetailInfo()
            }
        },
        mounted () {
			let langs = this.getCookie('site_lang')
			if (langs == 'en-US') {
				this.isShowEnglish = false
			}
            if (this.type) {
                this.achievementsForm.releaseCode = this.type;
                const obj = this.addTypeList.find(item => this.type === item.value);
                this.form.releaseCode = obj.label;
                this.$forceUpdate();
            }
            // 获取发布类型
            this.achievementsForm.releaseCode = this.type;

            buried('M_result_add_new', 'M_add_new_achieve_fill')
        },
        methods: {
			getCookie (cookieName) {
				var strCookie = document.cookie;
				var arrCookie = strCookie.split("; ");
				for (var i = 0; i < arrCookie.length; i++) {
					var arr = arrCookie[i].split("=");
					if (cookieName == arr[0]) {
					  return arr[1];
					}
				}
				return "";
			},
            // 最大长度
            asyncReleaseTitleCnengValidator (val) {
                if (val.length >= 128) {
                    return false
                }
            },
            // 验证数字
            asyncReleaseTitleCnValidator (val) {
                const regN = /^[!0-9]+$/;
                if (regN.test(val)) {
                    return false
                }
            },
            // 验证中午
            asyncValidator (val) {
                return new Promise(resolve => {
                    const reg = /[\u4e00-\u9fa5]/
                    resolve(!reg.test(val))
                })
            },
            // 根据 ID 获取详情信息
            async getDetailInfo () {
                const res = await this.$axios.get('/api/releaseResult/getReleaseResult', {
                    id: this.id || this.storeId
                })
                const { data } = res
                if (data.code !== 200) {
                    this.$toast(this.$t('message.hxxxsb'))
                } else {
                    this.form = {
                        releaseCode: data.data.releaseName,
                        releaseTitleCn: data.data.releaseTitleCn,
                        releaseTitleEn: data.data.releaseTitleEn,
                        releaseTime: data.data.releaseTime,
                        border: data.data.border,
                        province: data.data.province,
                        cityCode: data.data.cityCode,
                        regionCode: data.data.regionCode,
                        releaseLevel: data.data.releaseLevel,
                        releaseContent: data.data.releaseContent,
                        ossUrlList: data.data.ossUrlList,
                        releaseFieldOne: data.data.releaseFieldOne,
                        releaseFieldTwo: data.data.releaseFieldTwo,
                        releaseFieldThree: data.data.releaseFieldThree,
                        releaseFieldOther: data.data.releaseFieldOther,
                        userName: data.data.userName,
                        userPhone: data.data.userPhone,
                        landlineNumber: data.data.landlineNumber,
                        attributionCityCode: data.data.attributionCityCode, // 市及编码
                        attributionProvince: data.data.attributionProvince
                    }
                    this.achievementsForm = { ...data.data }
                    this.regionType.some(item => {
                        if (item.value === this.form.border) {
                            this.form.border = item.text
                            return true
                        }
                    })
                    // 显示国家编码
                    this.overseasType.some(item => {
                        if (this.achievementsForm.regionCode === item.value)
                            this.form.regionCode = item.text
                        return true
                    })
                    // 显示市及编码、省级编码
                    this.form.province = this.achievementsForm.provinceName
                    this.form.cityCode = this.achievementsForm.cityName
                    this.form.attributionProvince = this.achievementsForm.attributionProvinceName
                    this.form.attributionCityCode = this.achievementsForm.attributionCityName
                    // 显示发布内容
                    this.form.releaseLevel = this.achievementsForm.releaseLevelName
                }
            },
            // 显示发布日期
            releaseTimeShow () {
                if (!this.form.releaseTime) {
                    this.currentDate = new Date()
                } else {
                    this.currentDate = new Date(this.form.releaseTime)
                }
                this.releaseTimeShowPicker = true
            },
            // 发布日期确认按钮发生时
            releaseTimeConfirm (date) {
                this.form.releaseTime = `${date.getFullYear()}-${date.getMonth() +
                1}-${date.getDate()}`
                this.achievementsForm.releaseTime = `${date.getFullYear()}-${date.getMonth() +
                1}-${date.getDate()}`
                this.releaseTimeShowPicker = false
            },
            // 发布地区确认按钮发生时
            regionConfirm (data) {
                this.achievementsForm.border = data.value
                this.form.border = data.text
                this.regionShowPicker = false
            },
            // 境内确认按钮发生时
            provinceConfirm (data) {
                this.form.province = data.text // 省级编码
                this.achievementsForm.province = data.value // 省级编码
                this.form.cityCode = ''
                this.achievementsForm.cityCode = ''
                this.provinceShowPicker = false
            },
            // 境外身份确认按钮
            provinceConfirm2 (data) {
                this.form.attributionProvince = data.text // 省级编码
                this.achievementsForm.attributionProvince = data.value // 省级编码
                this.form.attributionCityCode = ''
                this.achievementsForm.attributionCityCode = ''
                this.provinceShowPicker2 = false
            },
            // 境内城市确认按钮发生时
            cityCodeConfirm (data) {
                this.form.cityCode = data.text // 省级编码
                this.achievementsForm.cityCode = data.value // 省级编码
                this.cityCodeShowPicker = false
            },
            // 境外城市确认按钮发生时
            cityCodeConfirm2 (data) {
                this.form.attributionCityCode = data.text // 市级编码
                this.achievementsForm.attributionCityCode = data.value // 市级编码
                this.cityCodeShowPicker2 = false
            },
            // 境外确认按钮发生时
            overseasConfirm (data) {
                this.form.regionCode = data.text
                this.achievementsForm.regionCode = data.value
                this.overseasShowPicker = false
            },
            // 发布层级确认按钮发生时
            releaseLevelConfirm (data) {
                this.achievementsForm.releaseLevel = data.value
                this.form.releaseLevel = data.text
                this.releaseLevelShowPicker = false
            },
            // 保存成果分类中的数据
            async savingAchievementsData () {
                let ossUrlLists = []
                if (this.$refs.uploadFile.fileList.length !== 0) {
                    ossUrlLists = this.$refs.uploadFile.fileList
                }
                this.achievementsForm.ossUrlList = ossUrlLists
                let params = {
                    landlineNumber: this.achievementsForm.landlineNumber || this.form.landlineNumber || '', // 座机号码
                    releaseFieldOne: this.achievementsForm.releaseFieldOne || this.form.releaseFieldOne || '', // 一级领域
                    releaseFieldOther: this.achievementsForm.releaseFieldOther || this.form.releaseFieldOther || '', // 其他领域
                    releaseFieldThree: this.achievementsForm.releaseFieldThree || this.form.releaseFieldThree || '', // 三级领域
                    releaseFieldTwo: this.achievementsForm.releaseFieldTwo || this.form.releaseFieldTwo || '', // 二级领域
                    userName: this.achievementsForm.userName || this.form.userName || '', // 填表人
                    userPhone: this.achievementsForm.userPhone || this.form.userPhone || '', // 联系电话
                    ossUrlList: this.achievementsForm.ossUrlList || this.form.ossUrlList || [], // 附件
                    releaseContent: this.achievementsForm.releaseContent || this.form.releaseContent || '', // 发布内容
                    border: this.achievementsForm.border || this.form.border || '', // 发布地区
                    releaseTime: this.achievementsForm.releaseTime || this.form.releaseTime || '', // 发布日期
                    releaseTitleCn: this.achievementsForm.releaseTitleCn || this.form.releaseTitleCn || '', // 成果中文名称
                    releaseTitleEn: this.achievementsForm.releaseTitleEn || this.form.releaseTitleEn || '', // 成果英文名称
                    releaseLevel: this.achievementsForm.releaseLevel || this.form.releaseLevel || '', // 发布层级
                    regionCode: this.achievementsForm.regionCode || this.form.regionCode || '', // 国家编码
                    cityCode: this.achievementsForm.cityCode || this.form.cityCode || '', // 市及编码
                    province: this.achievementsForm.province || this.form.province || '', // 省级编码
                    attributionCityCode: this.achievementsForm.attributionCityCode || this.form.attributionCityCode || '', // 中方企业属地（市）及编码
                    attributionProvince: this.achievementsForm.attributionProvince || this.form.attributionProvince || '', // 中方企业属地（省）
                    releaseCode: this.achievementsForm.releaseCode || this.form.releaseCode || '', // 类型
                    id: this.id || this.storeId // id
                }
                if (params.province.includes('-')) {
                    params.province = '';
                }
                let data = {}
                this.storeLoading = true
                if (this.id || this.storeId) {
                    data = await this.$axios.post(
                        '/api/releaseResult/updateReleaseResult',
                        params
                    )
                }
                if (!this.id && !this.storeId) {
                    delete params.id
                    data = await this.$axios.post(
                        '/api/releaseResult/draftReleaseResult',
                        params
                    )
                }
                this.storeLoading = false
                if (data.data.code === 200) {
                    this.storeId = data.data.data
                    this.$toast(this.$t('message.zccg'))
                }
                else {
                    this.$toast(this.$t('message.zcsb'))
                }
            },
            // 返回上一级
            returnFn () {
                window.history.go(-1)
            },
            // 下一步或者确认按钮
            async onSubmit () {

                if (this.storeId) {
                    this.getDetailInfo();
                }


                if (this.$refs.uploadFile.fileList.length !== 0) {
                    this.achievementsForm.ossUrlList = this.$refs.uploadFile.fileList
                }

                this.achievementsForm = {
                    ...this.achievementsForm,
                    landlineNumber: this.achievementsForm.landlineNumber || this.form.landlineNumber || '', // 座机号码
                    releaseFieldOne: this.achievementsForm.releaseFieldOne || this.form.releaseFieldOne || '', // 一级领域
                    releaseFieldOther: this.achievementsForm.releaseFieldOther || this.form.releaseFieldOther || '', // 其他领域
                    releaseFieldThree: this.achievementsForm.releaseFieldThree || this.form.releaseFieldThree || '', // 三级领域
                    releaseFieldTwo: this.achievementsForm.releaseFieldTwo || this.form.releaseFieldTwo || '', // 二级领域
                    userName: this.achievementsForm.userName || this.form.userName || '', // 填表人
                    userPhone: this.achievementsForm.userPhone || this.form.userPhone || '', // 联系电话
                    ossUrlList: this.achievementsForm.ossUrlList || this.form.ossUrlList || [], // 附件
                    releaseContent: this.achievementsForm.releaseContent || this.form.releaseContent || '', // 发布内容
                    border: this.achievementsForm.border || this.form.border || '', // 发布地区
                    releaseTime: this.achievementsForm.releaseTime || this.form.releaseTime || '', // 发布日期
                    releaseTitleCn: this.achievementsForm.releaseTitleCn || this.form.releaseTitleCn || '', // 成果中文名称
                    releaseTitleEn: this.achievementsForm.releaseTitleEn || this.form.releaseTitleEn ||'', // 成果英文名称
                    releaseLevel: this.achievementsForm.releaseLevel || this.form.releaseLevel || '', // 发布层级
                    regionCode: this.achievementsForm.regionCode || this.form.regionCode || '', // 国家编码
                    cityCode: this.achievementsForm.cityCode || this.form.cityCode || '', // 市及编码
                    province: this.achievementsForm.province || this.form.province || '', // 省级编码
                    attributionCityCode: this.achievementsForm.attributionCityCode || this.form.attributionCityCode || '', // 市及编码
                    attributionProvince: this.achievementsForm.attributionProvince || this.form.attributionProvince || '',
                    releaseCode: this.achievementsForm.releaseCode || this.form.releaseCode || '', // 类型
                    id: this.id || this.storeId // id
                }

                if (this.achievementsForm.province.includes('-')) {
                    this.achievementsForm.province = '';
                }
                this.$store.commit('changeStorage', this.achievementsForm)
                const params = {
                    id: this.id || this.storeId
                }
                if (params.id === 0) delete params.id
                this.$router.push({
                    path: './achievementsThirdly',
                    query: params
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .achievements-wrap {
        width: 100%;
        height: 100%;
        overflow-y: auto;
        /*background: rgba(243, 246, 250, 1);*/
        padding: 15px;
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
    }

    .achievements-step {
        flex-shrink: 0;
    }

    .achievements-body {
        overflow-y: auto;
    }

    .achievements-box {
        padding: 15px;
        background: #fff;
        margin-top: 18px;
        border-radius: 4px;

        h2 {
            width: 100%;
            height: 26px;
            line-height: 26px;
            font-weight: 500;
            color: rgba(33, 33, 33, 1);
        }
    }

    .achievements-submit {
        margin-top: 48px;

        .status-btn {
            margin-top: 15px;

            .van-button {
                &.van-button--default {
                    border-color: #cccfd4;
                }
            }
        }
    }

    .title-box {
        display: flex;
        align-items: center;
        height: 44px;
        /*line-height: 44px;*/

        h6 {
            font-weight: 500;
            color: rgba(33, 33, 33, 1);
            display: flex;
            align-items: center;

            &:before {
                content: "";
                width: 4px;
                height: 15px;
                margin-right: 6px;
                background: #fe8b01;
                display: inline-block;
                vertical-align: top;
            }
        }
    }

    .achievements-title {
        margin-top: -15px;
        line-height: 40px !important;
        height: 40px !important;
        border-bottom: 1px solid #ebedf0;
        margin-bottom: 20px;
    }
</style>
